package peer.rudp;

import java.util.ArrayList;
import java.util.HashSet;

import peer.rudp.message.ALMessage;


public class ALTask {
	ConnectionUDP conn;
	ALMessage alm;
	int lastRead=0;
	ArrayList<Integer> ackList;
	@SuppressWarnings("unchecked")
	HashSet set;
	ALTask(ConnectionUDP conn){
		this.conn=conn;
		ackList=new ArrayList();
		set=new HashSet();
	}
	
	void addAck(int sequence){
		//System.out.println("sendACK "+sequence);
		if(!set.contains(sequence)){
			ackList.add(sequence);
			set.add(sequence);
		}
		
	}
	
	void run(){
		conn.sender.sendALMessage(ackList);
	}
}
